﻿define(['services/layout',
        'services/dataservice'], 
	function (L, ds) {
	
    var loginModel = function () {
        this.user = ko.mapping.fromJS({
        	username: null,
        	password: null
        });
        this.rememberMe = ko.observable(false);
        this.formErrors = ko.observable();
    };

    loginModel.prototype.compositionComplete = viewCompositionComplete;
    loginModel.prototype.login = login;

    return loginModel;
    
    function viewCompositionComplete(view) {
    	L.relayout();
    }
    
    function login() {
    	ds.login(this.user);
    }
});